/**
 * @file 路由管理
 * @author Iain
 * @creation 2021/11/27
 */

import { RouterMount, createRouter } from "uni-simple-router";

const router = createRouter({
  // 不编码传输
  encodeURI: false,
  platform: process.env.VUE_APP_PLATFORM,
  // 路由表 ROUTES：通过webpack插件解析而来
  routes: [
    ...ROUTES,
  //   {
		//   path: '*',
		//   redirect:(to)=>{
		// 	  return {name:'404'}
		//   }
		// },
  ],
});

//全局路由前置守卫
router.beforeEach((to, from, next) => {
  console.log(to);
  next();
});

// 全局路由后置守卫
router.afterEach((to, from) => {
  console.log("跳转结束");
});

export { router, RouterMount };
